<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>split</title>
</head>
<body>
<script>
    function splitStr(str,type){
        var array=str.split(type);
        return array;
    };
    console.log(splitStr("123、456、789、123","、"));
    console.log(splitStr("123/456/789/123","/"));

    function toQfw(num){
        var str=num.toString();
        var reg=/(\d)(?=(\d{3})+\.)/g;
        if(str.indexOf('.')==-1){
            str=str+".";
        }else{
            str=str.slice(0,str.indexOf('.')+3)
        }
        var pointIndex=str.indexOf('.');
        str=str+new Array(3-str.slice(pointIndex+1).length).join(0);
        return str.replace(reg,'$1,');
    }
    console.log(toQfw(-13213.5));

</script>
</body>
</html>